<template>
    <div id="background">
        <el-container>
            <!-- <el-header id="zhangHaoHead">
                <img class="zhIcon" src="../../assets/img/mine/back.png" @click="backsz">
                <span class="zhHead">账号管理</span>
            </el-header> -->
            <el-header id="zhangHaoHeadPosition">
                <el-row type="flex" style="height:80%;display:flex;align-items: flex-end">
                    <el-col :xs="2" :sm="2" :md="2" :offset="1" class="imgCol">
                        <img v-bind:src="backIcon" class="backSize" @click="back" />
                    </el-col>
                    <el-col :xs="6" :sm="6" :md="6" :offset="6" class="imgCol">
                        <span class="titleSize">账号管理</span>
                    </el-col>
                </el-row>
            </el-header>
            <el-main id="zhangHaoMain">
                <el-row type="flex" style="height:10%;">
                    <el-col :xs="20" :sm="20" :md="20" :offset="1" class="imgCol">
                        <el-button class="zhBtn" @click="forget">
                            修改密码
                        </el-button>
                    </el-col>
                    <el-col :xs="2" class="imgCol" @click="forget">
                        <i class="el-icon-arrow-right"></i>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col class="imgCol">
                        <div class="line"></div>
                    </el-col>
                </el-row>
                <el-row type="flex" style="height:10%;">
                    <el-col :xs="20" :sm="20" :md="20" :offset="1" class="imgCol">
                        <el-button class="zhBtn" >
                            第三方账号绑定
                        </el-button>
                    </el-col>
                    <el-col :xs="2" class="imgCol">
                        <i class="el-icon-arrow-right"></i>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col class="imgCol">
                        <div class="line"></div>
                    </el-col>
                </el-row>
                <el-row type="flex" style="height:10%;">
                    <el-col :xs="20" :sm="20" :md="20" :offset="1" class="imgCol">
                        <el-button class="zhBtn" @click="logout">
                            退出登录
                        </el-button>
                    </el-col>
                    <el-col :xs="2" class="imgCol" @click="logout">
                        <i class="el-icon-arrow-right"></i>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col class="imgCol">
                        <div class="line"></div>
                    </el-col>
                </el-row>
            </el-main>
        </el-container>
    </div>
</template>

<script>
import { Dialog } from 'vant';
import backIcon from '../../assets/img/mine/back.png'
export default {
    data(){
       return{
           backIcon:backIcon,
           normalHeight:document.documentElement.clientHeight,
       }
    },
    mounted(){
        var bg = document.getElementById("background");
       // this.normalHeight=document.documentElement.clientHeight;
        console.log("height:"+this.normalHeight);
        bg.style.height = this.normalHeight+"px";
        bg.style.backgroundColor = "#FFFFFF"
        bg.style.margin = "0px";

        var head=document.getElementById("zhangHaoHeadPosition");
        var headHeight=this.normalHeight/30 *4 ;
        console.log("headHeight:"+headHeight);
        head.style.height=headHeight+"px";

        var main=document.getElementById("zhangHaoMain");
        var mainHeight=this.normalHeight/30 *24 ;
        main.style.height=mainHeight+"px";
    },
    methods:{
        forget(){
            console.log("forget:");
            this.$router.push({
                path:'/forget/forgetStep1'
            })
        },
        logout(){
            Dialog.confirm({
            message: '您确定退出新职通？'
            }).then(() => {
            // on confirm
                var URL=this.IP.IP+'/user/logout'
                this.$ajax({
                    method:'post',
                    url:URL,
                }).then(response=>{
                    console.log(response.data);
                    var code=response.data.code;
                    if(code==0){
                        this.$router.push({
                            path:'/'
                        })
                    }else{
                        console.log('退出失败');
                        // Toast(response.data.msg);
                    }
                }).catch(error=>{
                    console.log(error);
                // Toast(error);
                })
            }).catch(() => {
            // on cancel
            });
        },
        back(){
            console.log("back:");
            this.$router.go(-1);
        },
       

    }
}
</script>

<style>
#zhangHaoHeadPosition {
  background-color: #53cdf5;
}
.backSize{
    height: 26px;
}
.titleSize{
    font-size:1.125em;
    color:#ffffff
}
@media screen and (max-height: 600px){
  .backSize{
      height: 22px;
  }
  .titleSize{
      font-size: 1em;
  }
}

.el-main {
    padding: 0px ;
}

.line{
    width: 90%;
    height: 1px;
    background-color: #F0F0F0;
}
.imgCol{
    display:flex;
    align-items:center;
    justify-content:center
}

.zhBtn{
    border-style: none;
    outline: none;
    height: 40px;
    width: 100%;
    text-align: left;
    border: none;
    background-color: rgb(255,255,255,0);
    color: #707070;
    font-size: 1em;
}
/* .zhIcon{
    position: relative;
    top:40%;
    float:left;
    width:30px;
    height:30px;
}
.zhHead{
    position: relative;
    top:15%;
    right: 8px;
    font-size: 20px;
} */
#zhangHaoMain{
    background: #FFFFFF;
}

/* #zhangHaoHead{
    background-color: #53cdf5 !important;
    height: 45px;
    text-align: center;
    line-height: 60px;
    color: #FFFFFF;
    width: 100%;
} */
</style>
